//
//  FirstCell.swift
//  ShiZhe
//
//  Created by 陈卿伟 on 16/9/11.
//  Copyright © 2016年 陈卿伟. All rights reserved.
//

import UIKit

class FirstCell: UITableViewCell {
    var avatarImage:UIImageView!
    var userName:UILabel!
    var personLabel:UILabel!

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        avatarImage = UIImageView()
        userName = UILabel()
        personLabel = UILabel()
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .None
        self.accessoryType = .DisclosureIndicator
        self.createAvatarImage()
        self.createUserName()
        self.createPersonLabel()
        self.createRightLabel()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    //创建头像
    func createAvatarImage(){
        avatarImage.frame = CGRect(x: 25*SCALEW, y: 15*SCALEH, width: 50*SCALEW, height: 50*SCALEW)
        avatarImage.image = UIImage(named: "noAvatar")
        self.addSubview(avatarImage)
    }
    
    //创建用户名
    func createUserName(){
        userName.frame = CGRect(x: 90*SCALEW, y: 15*SCALEH, width: 170*SCALEW, height: 21*SCALEH)
        userName.textAlignment = .Left
        userName.textColor = UIColor.blackColor()
        userName.text = "不知道诶！"
        userName.font = BaseFunc.getCustomFont(15)
        self.addSubview(userName)
    }
    
    //创建个性签名
    func createPersonLabel(){
        personLabel.frame = CGRect(x: 90*SCALEW, y: 39*SCALEH, width: 179*SCALEW, height: 34*SCALEH)
        personLabel.textAlignment = .Left
        personLabel.textColor = Theme.GrayColor
        personLabel.text = "天若有情天亦老，我只想要吃好，喝好，睡好，拉屎好"
        personLabel.font = BaseFunc.getPingFangFont(12)
        personLabel.numberOfLines = 2
        self.addSubview(personLabel)
    }
    
    //创建右边提示文字
    func createRightLabel(){
        let rightLabel = UILabel(frame: CGRect(x: 293*SCALEW,y: 32*SCALEH,width: 58*SCALEW,height: 17*SCALEH))
        rightLabel.text = "设置头像"
        rightLabel.textColor = Theme.BlueColor
        rightLabel.textAlignment = .Right
        rightLabel.font = BaseFunc.getCustomFont(12)
        self.addSubview(rightLabel)
    }

}
